Repository navigation
fix: accept metadata sent as a JSON string of an object - #219
Merged
Merged
Conversation
Closes #85 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It stops at 200 levels of nesting and rejects NaN and Infinity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AstraBert
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Accept
metadatasent as a JSON stringCloses #85.
Problem
Some MCP clients, including Claude Code and Cursor, sometimes send an object argument as a JSON string:
"metadata": "{\"lang\": \"python\"}"instead of"metadata": {"lang": "python"}. These are known client bugs that are still open.qdrant-storethen fails withInput should be a valid dictionary, and the information isn't stored.Fix
metadatagets a pydanticBeforeValidator. If the value is a string that parses as a JSON object, it is replaced by that object before validation. Every other value passes through unchanged, so:nullbehave as before;"null"and invalid JSON are still rejected with the same error;objectornull), so well-behaved clients keep sending objects.Difference from #85
#85 changes the parameter type so that it also accepts strings. That would change the schema and tell clients a string is valid. This PR keeps the schema strict and only tolerates the string form at validation time.
Tests
tests/test_metadata_argument.py:object | null;metadatastill works;Full suite: 164 passed.
Thanks to @MyWWWChat for reporting this and proposing the first fix in #85.
🤖 Generated with Claude Code